<template>
    <a-pagination showSizeChanger showQuickJumper :showTotal="(total: number) =>
        `&nbsp;&nbsp;${$t('common.pagination.total')} ${pageResult.totalCount
        } ${$t('common.pagination.items')}`
        " v-model:current="pageRequest.current" v-model:pageSize="pageRequest.maxResultCount" :defaultPageSize="20"
        :pageSizeOptions="['20', '50', '100']" :total="pageResult.totalCount" @change="callParentFunc"
        @showSizeChange="showSizeChange" />
</template>

<script setup lang='ts'>
import type { PagedResultRequestDto } from '@/models/paged-result-request';

const props = defineProps<{ pageRequest: PagedResultRequestDto, pageResult: any }>();
const emits = defineEmits(['callFunc']);

function callParentFunc(): void {
    emits("callFunc");
}

function showSizeChange(): void {
    props.pageRequest.current = 1;
    emits("callFunc");
}
</script>

<style type="less" scoped>
.ant-pagination {
    border-top: 1px solid #f0f0f0;
}
</style>